<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- <link rel="icon" href="../../favicon.ico"> -->

    <title>注册</title>

    <!-- Bootstrap core CSS -->
    <link href="./libs/bootstarp/css/bootstrap.min.css" rel="stylesheet">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <!-- <link href="../../assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet"> -->

    <!-- Custom styles for this template -->
    <link href="./css/signin.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <!-- <script src="../../assets/js/ie-emulation-modes-warning.js"></script> -->

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>

    <div id="app" class="container">

        <form class="form-signin">
            <h2 class="form-signin-heading">注册</h2>
            <div class="form-group">
                <label for="inputName" class="sr-only">用户名</label>
                <input type="text" id="inputName" class="form-control" name="account" placeholder="请输入用户名" required
                    autofocus v-model="param.account">
            </div>
            <div class="form-group">
                <label for="inputPassword" class="sr-only">密码</label>
                <input type="password" id="inputPassword" class="form-control" name="password" placeholder="请输入密码"
                    required v-model="param.password">
            </div>
            <div class="checkbox">
                <label>
                    <input type="radio" v-model="param.type" name="type" value="0"> 用户账号
                </label>
                <label>
                    <input type="radio" v-model="param.type" name="type" value="1"> 企业账号
                </label>
            </div>
            <div class="form-group">
                <button class="btn btn-lg btn-primary btn-block" type="button" @click="handleOnSubmit">注册</button>
                <p>已有账号，<a href="./signin.html">立即登录</a></p>
            </div>
        </form>

    </div> <!-- /container -->


    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <!-- <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> -->
    <script src="./libs/jquery/jquery.min.js"></script>
    <script src="./libs/vue/vue.js"></script>
    <script src="./js/xhr.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data: function () {
                return {
                    param: {
                        account: '',
                        password: '',
                        type: '0'
                    }
                }
            },
            methods: {
                handleOnSubmit: function () {
                    if (this.param.account == '') {
                        alert('用户名不能为空')
                        return;
                    } else if (this.param.password == '') {
                        alert('密码不能为空')
                        return;
                    }
                    xhr.send('/pub/iface/job/register', this.param, function (res) {
                        window.location.replace('./signin.html')
                    })
                }
            },
        })
    </script>
</body>

</html>